import { ADD_PERSON } from '../counstant'
//初始化人的列表
const initState = [{id:'001',name:'tom',age:18}]
export default function personReducer(preState = initState, action) {
    let { type, data } = action
    switch (type) {
        case ADD_PERSON:    //若是添加一个人
            return [data,...preState]
        default:
            return preState
    }
}